﻿using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using VioletDevelopmentLaboratory.Net.Web;

public partial class vboard_membership_leave : VioletDevelopmentLaboratory.Net.Web.PageBase
{
	protected void Page_Init(object sender, EventArgs e)
	{
		Page.Header.Title = GetLocalResourceObject("Title").ToString();
	}
	protected void LeaveButton_Click(object sender, EventArgs e)
	{
		Membership.DeleteUser(Page.User.Identity.Name);

		FormsAuthentication.SignOut();

		Response.Redirect("~/");
	}
	protected void PasswordCheckButton_Click(object sender, EventArgs e)
	{
		if (Page.IsValid)
		{
			if (Membership.ValidateUser(Page.User.Identity.Name, PasswordTextBox.Text))
			{
				PasswordCheckPanel.Visible = false;
				LeaveFormPanel.Visible = !PasswordCheckPanel.Visible;
			}
			else
				VUtility.ShowMessagePanel(Page, VUtility.GetVWebGlobalResource("Membership_Do_CheckPassword_Failure"), true);
		}
	}
}
